package order.entity;

import lombok.Data;

import java.util.List;
@Data

public class PageResponse<T> implements java.io.Serializable {
    private List<T> records; // 当前页的数据记录
    private long total;       // 总记录数
    private long pageNum;     // 当前页码
    private long pageSize;    // 每页记录数
    private long totalPages;   // 总页数
    public PageResponse(List<T> records, long total, long pageNum, long pageSize) {
        this.records = records;
        this.total = total;
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalPages = (long) Math.ceil((double) total / pageSize); // 计算总页数
    }
}
